<%@ page import="com.apexedu.portal.constant.Constants" %>
<%@ page import="com.apexedu.portal.constant.ActionConstant" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title><%=Constants.ProjectInfo.PROJECT_NAME%>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <style>
        #main #contentSub{height: 650px;}
        #main #contentSub.contentSubshgh{height: 620px;}
        #contentTitleDiv {
            border-bottom: 1px solid #ccc;
            width: 100%;
            margin: 5px 0;
            line-height: 40px;
            height: 40px;
            font-size: 16px;
        }

        #contentTitleDiv h3 {
            margin: 0;
            float: left;
            font-size: 18px;
            font-weight: normal;
            line-height: 30px;
            height: 30px;
            color: #e74c3c;
        }

        #contentTitleDiv .searchSpan {
            margin-left: 450px;
            margin-right: 20px;
        }

        .contentSubshgh #contentTitleDiv .searchSpan{
            margin-left: 650px;
        }

        #contentTitleDiv .searchSpan .search {
            font-size: 12px;
            color: blue;
            cursor: pointer;
        }

        #contentTitleDiv img {
            cursor: pointer;
        }

        #contentSub a {
            text-decoration: none;
            color: #333;
        }
    </style>
</head>
<body>
<div id="main">
    <jsp:include page="<%=Constants.ProjectInfo.HEAD_VIEW%>"/>
    <script type="text/javascript">
        $(function () {
            $(".search").click(function () {
                var title = $("#titleId").val();
                var pageno = 1;
                doGet(pageno, title);
            });
            $(".prev").click(function () {
                var title = $("#titleId").val();
                var pageno = parseInt($(".pageNoB").html(), 10);
                if (pageno != 1) {
                    pageno--;
                }
                doGet(pageno, title);
            });
            $(".next").click(function () {
                var title = $("#titleId").val();
                var pageno = parseInt($(".pageNoB").html(), 10);
                var totalPageNo = parseInt($(".totalPageNoB").html(), 10);
                if (pageno != totalPageNo) {
                    pageno++;
                }
                doGet(pageno, title);
            });
            $(".go").click(function () {
                var title = $("#titleId").val();
                var go = parseInt($("#go").val(), 10);
                var totalPageNo = parseInt($(".totalPageNoB").html(), 10);
                if (go >= 1 && go <= totalPageNo) {
                    doGet(go, title);
                    $("#go").val(null);
                } else {
                    alert("请输入正确页数");
                    $("#go").val(null);
                }
            });

            $(document).on("keydown", "#titleId", function (e) {
                var mykeyCode;
                if (document.all) {
                    mykeyCode = window.event.keyCode;
                } else {
                    mykeyCode = event.which;
                }
                if (mykeyCode == 13) {
                    $(".search").click();
                }
            });
        });

        function doGet(p, title) {
            window.location.href = '${basePath}/s/uc/mh/l/${db}/${id}?p=' + p + '&title=' + encodeURIComponent(encodeURIComponent(title))+"&t="+encodeURIComponent(encodeURIComponent('${typeTitle}'));
        }
    </script>
    <div id="content">
        <div id="contentSub" class="contentSub<%=Constants.ProjectInfo.PROJECT_CODE%>">
            <div id="contentTitleDiv">
                <h3>${typeTitle}</h3>
					<span class="searchSpan">标题：
                        <input type="text" style="width: 150px;" name="title" id="titleId" value="${title}"/>
                        <label class="search">查询</label></span>
                <span class="turnSpan">
                    <img src="${basePath}/resources/images/left.png" class="prev">
						&nbsp;&nbsp;<b class="pageNoB">${pager.currentPageno}</b>&nbsp;/&nbsp;
                        <b class="totalPageNoB">${pager.totalPages}
                        </b>&nbsp; <img
                        src="${basePath}/resources/images/right.png" class="next">&nbsp;&nbsp;
					</span> <span class="" style="color: #333333"><input type="text"
                                                                         style="width: 25px;" name="go" id="go"/> <a
                    href="#" class="go">Go</a>
					</span>
            </div>
            <table style="width: 100%;">
                <c:forEach items="${list}" var="lbxx">
                    <tr>
                        <td style='width: 80%; text-align: left; font-size: 14px; line-height: 25px;'>
                            <a target='_blank' href="${basePath}/s/uc/mh/no/oa/${lbxx.id}">${lbxx.title}</a>
                            <c:if test="${lbxx.isnew}">
                                <img src="${basePath}/resources/images/new.gif"/>
                            </c:if>
                        </td>
                        <td style='width: 20%; text-align: right; font-size: 14px; line-height: 25px;'>
                            <fmt:formatDate value="${lbxx.time}" pattern="yyyy-MM-dd"/>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
        <div id="contentBg"></div>
    </div>
    <jsp:include page="<%=Constants.ProjectInfo.FOOT_VIEW%>"/>
</div>
</body>
</html>
